<template>
  <!--查看详情-->
  <!--模态框-->
  <div>

    <el-dialog title="订单详情" :visible.sync="dialogTableVisible">

      <el-table :data="Orderdetail">
        <el-table-column   label="商品图片" width="200">
            <template slot-scope="scope">
              <img height="100px" width="100px" :src="scope.row.shopInfo.imags[0].imagUrl">
          </template>

        </el-table-column>
        <el-table-column property="shopInfo.shopName" label="商品名称"></el-table-column>
        <el-table-column property="shopInfo.shopPrice" label="商品价格"></el-table-column>
        <el-table-column property="shopInfo.shopUnit" label="商品单位"></el-table-column>
        <el-table-column property="buyQuantity" label="购买数量"></el-table-column>
        <el-table-column property="sumPrice" label="总价格"></el-table-column>
        <el-table-column label="是否退货">
          <template slot-scope="scope">
            <el-tag type="success" v-if="scope.row.isReturn=='0'">未退货</el-tag>
            <el-tag type="success" v-if="scope.row.isReturn=='1'">待退货</el-tag>
            <el-tag type="success" v-if="scope.row.isReturn=='2'">退货完成</el-tag>
            <el-tag type="success" v-if="scope.row.isReturn=='3'">退货失败</el-tag>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageno"
        :page-sizes="[5, 10, 15, 20]"
        :page-size="pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </el-dialog>
  </div>
</template>

<script>
    export default {
        name: "Orders_view_details",
      data(){
          return{
            pageno: 1,
            pagesize: 5,
            total: 1,
            Orderdetails:{pId:""},
            Orderdetail:[],
            dialogTableVisible:false
          }
      },
      methods:{
        getOrderdetailDetails(){
          var params = new URLSearchParams();
          params.append("pageno", this.pageno);
          params.append("pagesize", this.pagesize);
          params.append("pId",this.Orderdetails.pId)
          this.$axios.get("queryOrdersParticulars.action",{params:params}).then(res=>{
            this.Orderdetail=res.data.records;
            this.total=res.data.total;
            this.Orderdetail.forEach(item=>{
              item.shopInfo.imags[0].imagUrl="http://127.0.0.1:9090/demo/"+item.shopInfo.imags[0].imagUrl;
            })
          }).catch(error=>{
            this.$message.error(error)
          })
        },
        handleSizeChange(val) {
          //每页范围
          this.pagesize = val;
          this.getordersData();
        },
        handleCurrentChange(val) {
          //当前页
          this.pageno = val;
          this.getordersData();
        },
      },

    }
</script>

<style scoped>

</style>
